import { createRouter, createWebHashHistory } from "vue-router";
import HomeView from "../views/HomeView.vue";

// 当前数组中直接书写的对象属于一级路由
export const routes = [
    {
        path: "/",
        name: "home",
        component: HomeView,
        children: [
            // 当前数组中书写的对象属于二级路由
            {
                // 用户管理
                path: "manager",
                name: "manager",
                label: '人员管理',
                component: () => import("../views/manager/managerIndexView.vue"),
                // 当前数组中书写的对象属于三级路由
                children: [
                    {
                        // 人员列表
                        path: "managerlist",
                        name: "managerlist",
                        label: '用户列表',
                        component: () => import("../views/manager/managerListView.vue"),
                    },
                    {
                        // 管理员列表
                        path: "adminlist",
                        name: "adminlist",
                        label: '管理员列表',
                        component: () => import("../views/manager/adminListView.vue"),
                    },
                ]
            },
            {
                // 轮播图管理
                path: "banner",
                name: "banner",
                label: '轮播图管理',
                component: () => import("../views/banner/bannerIndexView.vue"),
                // 当前数组中书写的对象属于三级路由
                children: [
                    {
                        // 轮播图列表
                        path: "bannerlist",
                        name: "bannerlist",
                        label: '轮播图列表',
                        component: () => import("../views/banner/bannerListView.vue"),
                    },
                    {
                        // 添加轮播图
                        path: "addbanner",
                        name: "addbanner",
                        label: '添加轮播图',
                        component: () => import("../views/banner/addBannerView.vue"),
                    },
                ]
            }
        ],
    },
    {
        path: "/login",
        name: "login",
        component: () => import("../views/loginView.vue"),
    },
];

const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes,
});

export default router;
